-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagation: only warn about oversized baggage headers when headers exist #2212
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks weird to check for if not something
and then immediate if something
but approving :)
@owais Yeah, I wasn't sure myself, I tried to go for the smallest change and that was probably not the best idea 😅 Do you think the following would be better? if not header:
return context
if len(header) > self._MAX_HEADER_LENGTH:
_logger.warning(
"Baggage header `%s` exceeded the maximum number of bytes per baggage-string",
header,
)
return context |
I feel your snippet is more clear and shows the intent of the function better. I'm fine either way. |
Please add a changelog entry |
This commit makes sure that warnings about the baggage header length are only emitted when the header is actually present, since it does not make sense to warn about a missing header's length.
Should be all fixed! 😄 |
Set to auto-merge once it receives a 2nd approval. |
You are the savior Thanks a ton for fixing so early. |
Description
Warnings were being logged about the baggage header being too long when the header was not present. This PR just adds a check to make sure the warning is only emitted when the header exists.
The main issue is that this was creating a lot of noise in logs, because the project where opentelemetry is used is the first one to receive requests (and thus will never have the baggage header set).
Type of change
How Has This Been Tested?
Tox has been run. I'm not sure much else is necessary, given that no behavior has been changed, only logging.
Does This PR Require a Contrib Repo Change?
Checklist: